#ifndef _CLOCK_H_
#define _CLOCK_H_

#include "sc95f_timer0.h"
#include "ClockConfig.h"

#define CLOCK_TIMER0 0
#define CLOCK_TIMER1 1
#define CLOCK_TIMER2 2
#define CLOCK_TIMER3 3
#define CLOCK_TIMER4 4

#define PRESSEL_FSYS_D1 0x01
#define PRESSEL_FSYS_D12 0x00

#if (CLOCK_PrescalerSelection == PRESSEL_FSYS_D12)
#define CLOCK_TIM0_PrescalerSelection TIM0_PRESSEL_FSYS_D12
#define CLOCK_TIM1_PrescalerSelection TIM1_PRESSEL_FSYS_D12
#define CLOCK_TIM2_PrescalerSelection TIM2_PRESSEL_FSYS_D12
#define CLOCK_TIM3_PrescalerSelection TIM3_PRESSEL_FSYS_D12
#define CLOCK_TIM4_PrescalerSelection TIM4_PRESSEL_FSYS_D12
#elif (CLOCK_PrescalerSelection == PRESSEL_FSYS_D1)
#define CLOCK_TIM0_PrescalerSelection TIM0_PRESSEL_FSYS_D1
#define CLOCK_TIM1_PrescalerSelection TIM1_PRESSEL_FSYS_D1
#define CLOCK_TIM2_PrescalerSelection TIM2_PRESSEL_FSYS_D1
#define CLOCK_TIM3_PrescalerSelection TIM3_PRESSEL_FSYS_D1
#define CLOCK_TIM4_PrescalerSelection TIM4_PRESSEL_FSYS_D1
#endif

#define CLOCK_WorkMode0 0
#define CLOCK_WorkMode1 1
#define CLOCK_WorkMode2 2
#define CLOCK_WorkMode3 3

#if (CLOCK_WorkMode == CLOCK_WorkMode0)
#define CLOCK_TIM0_WorkModeConfig TIM0_WorkMode0Config
#define CLOCK_TIM0_ModeSetReloadCounter TIM0_Mode0SetReloadCounter
#define CLOCK_TIM1_WorkModeConfig TIM1_WorkMode0Config
#define CLOCK_TIM1_ModeSetReloadCounter TIM1_Mode0SetReloadCounter
#define CLOCK_TIM2_WorkModeConfig TIM2_WorkMode0Config
#define CLOCK_TIM2_ModeSetReloadCounter TIM2_Mode0SetReloadCounter
#define CLOCK_TIM3_WorkModeConfig TIM3_WorkMode0Config
#define CLOCK_TIM3_ModeSetReloadCounter TIM3_Mode0SetReloadCounter
#define CLOCK_TIM4_WorkModeConfig TIM4_WorkMode0Config
#define CLOCK_TIM4_ModeSetReloadCounter TIM4_Mode0SetReloadCounter
#elif (CLOCK_WorkMode == CLOCK_WorkMode1)
#endif

void Clock_init();
uint32_t Clock_mills();

#endif
